package com.asset.mapper;

import com.asset.model.entity.BudgetApplication;
import com.asset.model.entity.BudgetApplicationDetail;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 针对
 * 【t_budget_application(预算申请表)】
 * 【t_budget_application_detail(预算申请明细表)】
 * 的数据库操作 Mapper
 */
public interface BudgetMapper {
    /**
     * 新增预算申请
     */
    int insertBudgetApplication(BudgetApplication budgetApplication);

    /**
     * 更新预算申请状态
     */
    void updateBudgetStatus(BudgetApplication budgetApplication);

    /**
     * 更新预算申请
     */
    int updateBudget(BudgetApplication budgetApplication);

    /**
     * 根据 id 获取预算申请记录
     */
    BudgetApplication selectBudgetApplicationById(@Param("budgetId") Integer budgetId);

    /**
     * 更新流程实例 ID
     */
    void updateWorkflowId(BudgetApplication budgetApplication);

    /**
     * 插入一条预算申请详情
     */
    int insertBudgetApplicationDetail(BudgetApplicationDetail budgetApplicationDetail);

    /**
     * 分页查询预算申请
     */
    List<BudgetApplication> selectBudgetApplicationQueryWrapper(
            @Param("id") Integer id,
            @Param("budgetName") String budgetName,
            @Param("status") Integer status,
            @Param("approvalStatus") String approvalStatus);

    /**
     * 分页获取预算申请资产列表
     */
    List<BudgetApplicationDetail> selectBudgetDetailQueryWrapper(
        @Param("id") Integer id,
        @Param("budgetApplicationId") Integer budgetApplicationId,
        @Param("assetName") String assetName,
        @Param("categoryId") Integer categoryId
    );

    /**
     * 删除预算申请详情
     */
    int delBudgetApplicationDetail(Integer id);

    /**
     * 删除预算申请
     */
    int delBudgetApplication(Integer budgetApplicationId);

}
